package com.lxj.collection;

import java.awt.List;
import java.util.LinkedList;
import java.util.Queue;

import com.lxj.charactor.Hero;

/**
 * TestQueue
 */
public class TestQueue {

    public static void main(String[] args) {
        LinkedList<Hero> ll = new LinkedList<Hero>();

        Queue<Hero> q = new LinkedList<>();

        // 加在队列的最后面
        System.out.println("初始化队列: \t");
        q.offer(new Hero("Hero01"));
        q.offer(new Hero("Hero2"));

        System.out.println(q);

        System.out.println("把第一个元素poll()出来:\t");

        Hero h = q.poll();

        System.out.println(h);
        System.out.println(q);

        h = q.peek();
        System.out.println(h);
        System.out.println(q);
    }
}